package exception_exercise;

public class TryCatchDemo2 {
    public static void main(String[] args) {
        System.out.println("程序开始");
        try{
            String line4=null;
            System.out.println(line4.length());
            String line5="";
            System.out.println(line5.charAt(0));
            String line6="abc";
            System.out.println(Integer.parseInt(line6));
        }catch (NullPointerException | StringIndexOutOfBoundsException e2){
            System.out.println("出现了空指针或字符串下标越界异常并解决了");
        }catch (Exception e2){
            System.out.println("出现了错误并解决了");
        }
        System.out.println("程序结束");
    }
}
